package top.ninwoo.common.entity;

import lombok.Data;

/**
 * @Author joliu
 * @Description 描述网络拓扑, 这个数据结构最终要存储到数据库中
 * @Date　Create in 下午9:30 2019/11/6
 */
@Data
public class NetworkTopology {
    private long topologyId;
    private String[] appNames;
    private int[][] topology;

    public boolean containsAppName(String appName) {
        if(topology != null) {
            for (int i = 0; i < appNames.length; i++) {
                if (appNames[i].equals(appName)) {
                    return true;
                }
            }
        }

        return false;
    }
/*    public NetworkTopology(long topologyId, String[] appNames) {
        this.topologyId = topologyId;
        this.appNames = appNames;
        if(appNames == null || appNames.length < 1) {
            throw new RuntimeException("容器的数组不能为空");
        }
        topology = new int[appNames.length][appNames.length];
    }*/
}
